<%@page import="df.jsp.LabelMap"%>
<%@include file="_global.jsp" %>
<%@page import="df.bean.db.conn.DBConnection"%>
<%@page import="java.sql.*"%>
<%@page import="df.bean.obj.util.Variables"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="css/share.css" media="all" />
        <link rel="stylesheet" type="text/css" href="css/header.css" media="all" />
    <script language="Javascript">
        function changeLableMenu(value){
            var e = document.getElementById("control_menu");
            if(value){
                e.innerHTML = "&nbsp;&nbsp;&nbsp;<a href='javascript:parent.toggleFrame();'><img src='images/show_menu_button.png' width='15' height='15' /></a><font color='#FFFFFF'>&nbsp;&nbsp;Hide Menu</font>";
            }else{
                e.innerHTML = "&nbsp;&nbsp;&nbsp;<a href='javascript:parent.toggleFrame();'><img src='images/hide_menu_button.png' width='15' height='15' /></a><font color='#FFFFFF'>&nbsp;&nbsp;Show Menu</font>";
            }
        }
        function ChangeLang(ln){
            var e = document.getElementById("ifrm");
            if(ln=="TH"){
                e.src = "switch_lang.jsp?lang=<%=LabelMap.LANG_TH%>";
            }else{
                e.src = "switch_lang.jsp?lang=<%=LabelMap.LANG_EN%>";
            }
            parent.mainFrame.location.reload();
            parent.leftFrame.location.reload();
        }
    </script>
    </head>
    <body>
        <div id="header_left">
            <table width="100%">
                <tr>
                    <td width="3"></td>
                    <td id="control_menu" width="160">
                        &nbsp;&nbsp;&nbsp;<a href="javascript:parent.toggleFrame();" title="Import"><img src='images/show_menu_button.png' width='15' height='15' /></a><font color='#FFFFFF'>&nbsp;&nbsp;Hide Menu</font>
                    </td>
                    <td width="55">
			<a href="javascript:ChangeLang('TH');" ><img src="images/thai_flag.jpg" width="16" height="11" /></a> |
			<a href="javascript:ChangeLang('EN');" ><img src="images/eng_flag.jpg" width="16" height="11" /></a>
                    </td>
                    <td>
			            <%
			            //String menusql = "select * from STP_MENU order by convert(int,CODE)";
			            String menusql = "select ICON_LINK, ICON_PICTURE, ICON_DESCRIPTION from STP_MENU as a where HOSPITAL_CODE = '"+session.getAttribute("HOSPITAL_CODE")+"' AND CODE in (select MENU_CODE from STP_MENU_MATCH as b where b.MENU_CODE=a.CODE and b.USER_GROUP_CODE='"+ session.getAttribute("USER_GROUP_CODE").toString() +"') " +
			                    //"and a.HOSPITAL_CODE = '"+session.getAttribute("HOSPITAL_CODE").toString()+"' and a.ICON_LINK IS NOT NULL and a.ICON_LINK<>'' order by convert(int,CODE);";
			                    "and a.ICON_LINK IS NOT NULL and a.ICON_LINK<>'' order by convert(int,CODE);";
			            
			            DBConnection con = new DBConnection();
			            con.connectToLocal();
			            
			            ResultSet rs = con.executeQuery(menusql);
			            int i = 0;
			            while (rs.next()) {
			           		out.println("<a href=\""+ rs.getString("ICON_LINK") +"\" target=\"mainFrame\"><img src=\""+ rs.getString("ICON_PICTURE") +"\" class=\"interfaceButton\" alt=\""+ rs.getString("ICON_DESCRIPTION") +"\"/></a>");
			                i++;
			            }
			            con.Close();
			            %>                    
            		<a href="user_manual.pdf" ><img src="images/help_button.png" class="helpButton" alt="Manual" onmouseover="src='images/help_hover_button.png'" onmouseout="src='images/help_button.png'" /></a>
                    </td>
                </tr>
            </table>
        </div>
        <div id="header_right">
            <a href="logout.jsp" title="Log out" target="_top"><img src="images/logout_button.png" class="logOutButton" alt="Log out" onmouseover="src='images/logout_hover_button.png'" onmouseout="src='images/logout_button.png'" /></a>
        </div>
        <div class="clearFloat"></div>
        <iframe id="ifrm" name="ifrm" src="" width="200" height="10"></iframe>
     </body>
</html>
